/**
 * Bolg main JS.
 * Created by waylau.com on 2017/3/9.
 */
"use strict";
//# sourceURL=main.js

// DOM 加载完再执行
$(function() {
	$("#submit").click(function () {
        var data = {
            username:$("#username").val(),
            email:$("#email").val(),
            name:$("#name").val(),
            password:$("#password").val()
        };
        $.ajax({
            url: "/toRegister",
            data:data,
            success: function(data){
                console.log(data);
                if(!data.success){
                    toastr.error(data.message);
                }else{
                    window.location.href = "login";
                }
            },
            error : function() {
                toastr.error("error!");
            }
        });
    });
});